<?php
/**
 * 后台菜单配置
 *    'home' => [
 *       'name' => '首页',                // 菜单名称
 *       'icon' => 'icon-home',          // 图标 (class)
 *       'index' => 'index/index',         // 链接
 *     ],
 */
use think\Session;
use think\Db;
$session=Session::get('yoshop_admin');
if($session){
    $userType=Db::name('love_admin_user')->where(['id'=>$session['user']['id']])->value('type');
}else{
    $userType=1;
}

if($userType==1){
    //主管理员
    return [
        'index' => [
            'name' => '首页',
            'icon' => 'icon-home',
            'index' => 'index/index',
        ],
        'goods' => [
            'name' => '首页管理',
            'icon' => ' icon-goods',
            'index' => 'goods.goods/index',
            'submenu' => [
                [
                    'name' => '首页数据列表',
                    'index' => 'goods.goods/index',
                ],
            ]
        ],
        'general' => [
            'name' => '常规管理',
            'icon' => 'icon-daohang',
            'index' => 'general.storage/index',
            'submenu' => [

            ]
        ],
        'admin' => [
            'name' => '区域管理',
            'icon' => 'icon-guanliyuan',
            'index' => 'admin.user/index',
            'submenu' => [
                [
                    'name' => '区域列表',
                    'index' => 'admin.user/index',
                    'uris' => [
                        'admin.user/index',
                        'admin.user/add',
                        'admin.user/edit',
                        'admin.user/delete',
                    ],
                ],
            ]
        ],
        'files' => [
            'name' => '楼盘管理',
            'icon' => 'icon-marketing',
            'index' => 'files.build/index',
            'submenu' => [
                [
                    'name' => '房源列表',
                    'index' => 'files.build/index',
                    'uris' => [
                        'files.build/index',
                        'files.build/add',
                        'files.build/edit',
                    ]
                ]
            ],
        ],
        'content' => [
            'name' => '标签管理',
            'icon' => 'icon-wenzhang',
            'index' => 'content.article/index',
            'submenu' => [
                [
                    'name' => '标签管理',
                    'active' => true,
                    'submenu' => [
                        [
                            'name' => '标签列表',
                            'index' => 'content.article/index',
                            'uris' => [
                                'content.article/index',
                                'content.article/add',
                                'content.article/edit',
                            ]
                        ],
                    ]
                ]
            ]
        ],

        'agent' => [
            'name' => '人员管理',
            'icon' => 'icon-daohangpinlei',
            'index' => 'agent.agent/index',
            'submenu' => [
                [
                    'name' => '人员列表',
                    'index' => 'agent.agent/index',
                    'uris' => [
                        'agent.agent/index',
                        'agent.agent/add',
                        'agent.agent/edit',
                    ]
                ],
            ],
        ],
        'store' => [
            'name' => '客户信息查看',
            'icon' => 'icon-shangcheng',
            'index' => 'store.store/index',
            'submenu' => [
                [
                    'name' => '客户列表',
                    'index' => 'store.store/index',
                    'uris' => [
                        'store/index',
                        'store/add',
                    ]
                ]
            ],
        ],
        'finance' => [
            'name' => '客户流转日志',
            'icon' => 'icon-iconfonticonfontshan',
            'index' => 'finance.system/index',
            'submenu' => [
                [
                    'name' => '流转日志',
                    'index' => 'finance.system/index',
                ],
            ],
        ]
    ];

}elseif ($userType==2){
    //城市管理员
    return [
        'index' => [
            'name' => '首页',
            'icon' => 'icon-home',
            'index' => 'index/index',
        ],
        'agent' => [
            'name' => '人员信息查看',
            'icon' => 'icon-daohangpinlei',
            'index' => 'agent.agent/index',
            'submenu' => [
                [
                    'name' => '人员列表',
                    'index' => 'agent.agent/index',
                    'uris' => [
                        'agent.agent/index',
                        'agent.agent/add',
                        'agent.agent/edit',
                    ]
                ],
            ],
        ],

        'files' => [
            'name' => '楼盘信息查看',
            'icon' => 'icon-marketing',
            'index' => 'files.build/index',
            'submenu' => [
                [
                    'name' => '房源列表',
                    'index' => 'files.build/index',
                    'uris' => [
                        'files.build/index',
                        'files.build/add',
                        'files.build/edit',
                    ]
                ]
            ],
        ],
        'store' => [
            'name' => '客户信息查看',
            'icon' => 'icon-shangcheng',
            'index' => 'store.store/index',
            'submenu' => [
                [
                    'name' => '客户列表',
                    'index' => 'store.store/index',
                    'uris' => [
                        'store/index',
                        'store/add',
                    ]
                ]
            ],
        ],
    ];

}elseif ($userType==3){
    //区域管理员
    return [
        'index' => [
            'name' => '首页',
            'icon' => 'icon-home',
            'index' => 'index/index',
        ],
        'agent' => [
            'name' => '人员信息查看',
            'icon' => 'icon-daohangpinlei',
            'index' => 'agent.agent/index',
            'submenu' => [
                [
                    'name' => '人员列表',
                    'index' => 'agent.agent/index',
                    'uris' => [
                        'agent.agent/index',
                        'agent.agent/add',
                        'agent.agent/edit',
                    ]
                ],
            ],
        ],
        'files' => [
            'name' => '楼盘信息查看',
            'icon' => 'icon-marketing',
            'index' => 'files.build/index',
            'submenu' => [
                [
                    'name' => '房源列表',
                    'index' => 'files.build/index',
                    'uris' => [
                        'files.build/index',
                        'files.build/add',
                        'files.build/edit',
                    ]
                ]
            ],
        ],
        'store' => [
            'name' => '客户管理',
            'icon' => 'icon-shangcheng',
            'index' => 'store.store/index',
            'submenu' => [
                [
                    'name' => '客户列表',
                    'index' => 'store.store/index',
                    'uris' => [
                        'store/index',
                        'store/add',
                    ]
                ]
            ],
        ],
    ];
}else{
    //楼管管理人员
    return [
        'louguan' => [
            'name' => '楼管信息查看',
            'icon' => 'icon-daohangpinlei',
            'index' => 'louguan.louguan/index',
            'submenu' => [
                [
                    'name' => '楼管列表',
                    'index' => 'louguan.louguan/index',

                ],
            ],
        ],
        'customer' => [
            'name' => '客户信息查看',
            'icon' => 'icon-shangcheng',
            'index' => 'customer.customer/index',
            'submenu' => [
                [
                    'name' => '客户列表',
                    'index' => 'customer.customer/index',

                ]
            ],
        ],
    ];
}
